{
 "metadata": {
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.2"
  },
  "orig_nbformat": 2,
  "kernelspec": {
   "name": "python3",
   "display_name": "Python 3",
   "language": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2,
 "cells": [
  {
   "source": [
    "# 赋值运算符"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "source": [
    "## `=`\n",
    "\n",
    "将 `=` 右侧的值赋值给等号左侧的变量"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "a = 10\n",
    "print(a)"
   ]
  },
  {
   "source": [
    "## `+=`\n",
    "\n",
    "`a += x` 相当于 `a = a + x`"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "a = 10\n",
    "b = 'Hello'\n",
    "a += 5\n",
    "b += ' World'\n",
    "print(a)\n",
    "print(b)"
   ]
  },
  {
   "source": [
    "## `-=`\n",
    "\n",
    "`a -= x` 相当于 `a = a - x`"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "a = 10\n",
    "a -= 5\n",
    "print(a)"
   ]
  },
  {
   "source": [
    "## `*=`\n",
    "\n",
    "`a *= x` 相当于 `a = a * x`"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "a = 10\n",
    "a *= 5\n",
    "print(a)"
   ]
  },
  {
   "source": [
    "## `/=`\n",
    "\n",
    "`a /= x` 相当于 `a = a / x`"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "a = 10\n",
    "a /= 5\n",
    "print(a)"
   ]
  },
  {
   "source": [
    "## `//=`\n",
    "\n",
    "`a //= x` 相当于 `a = a // x`"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "a = 10\n",
    "a //= 3\n",
    "print(a)"
   ]
  },
  {
   "source": [
    "## `%=`\n",
    "\n",
    "`a %= x` 相当于 `a = a % x`"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "a = 10\n",
    "a %= 3\n",
    "print(a)"
   ]
  }
 ]
}